<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html style="font-size:42px;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>促销商城  猜红包</title>
<head>
		<meta charset="UTF-8">
		<meta name="viewport" content=" initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<meta name="format-detection" content="telephone=no">
		<title>拆红包</title>
		<style>
			*{margin: 0;padding: 0;list-style: none;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0);   box-sizing: border-box;  -webkit-box-sizing: border-box;  -moz-box-sizing: border-box;  -o-box-sizing: border-box;}
			 body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, form, fieldset, legend, button, input, textarea, th, td { margin: 0; padding: 0; }  button, input, select, textarea { font: 12px/1.5 tahoma, arial, \5b8b\4f53, sans-serif; } h1, h2, h3, h4, h5, h6 { font-size: 100%; } address, cite, dfn, em, var { font-style: normal; } /* ��б����� */ code, kbd, pre, samp { font-family: courier new, courier, monospace; } /* ͳһ�ȿ����� */ small { font-size: 12px; }  ul, ol { list-style: none; } a { text-decoration: none; } a:hover { text-decoration: underline; } legend { color: #000; } fieldset, img { border: 0; }  button, input, select, textarea { font-size: 100%; } table { border-collapse: collapse; border-spacing: 0; }				 
			body{
				font-family: "sans-serif","Clockopia", "arial";
				max-width: 800px;
				margin: 0 auto;
				font-size: .24rem;
				/*margin-bottom: 50px;*/
			}
		</style>
		
		<link rel="stylesheet" href="../public/lobster/css/style.css?2170609" />
		<link rel="stylesheet" href="../public/lobster/icon/iconfont.css?2170402">
	    <link rel="stylesheet" href="../public/lobster/css/public.css?55555">
	    <link rel="stylesheet" href="../public/lobster/css/shared.css?66666">
	    <script src="../public/lobster/js/public.js?55555"></script>
	<style type="text/css">
    	.box{ height:.7rem; border-radius: 2rem;overflow:hidden;width:90%;margin:0 auto;background: #d12115;}
		.t_news{ height:.5rem;  color:#fff; padding-left:.4rem; margin:8px 0; overflow:hidden; position:relative;}
		.t_news b{ line-height:.5rem; font-weight:bold; display:inline-block;}
		.news_li,.swap{ line-height:.5rem; display:inline-block; position:absolute; top:0; }
		.news_li a,.swap a{ color:#fff;}
		.swap li,.news_li li{font-size:.3rem;width:100%;}
		.swap{top:0.5rem;}	
	</style>
	</head>
	<body>
		<div class="main">
			<div style="height: 5.46rem;background: url(../public/lobster/images/banner.png) no-repeat;background-size:100%";></div>
			<div class="select">
				<div id="off-kaijiang">
					<a href="javascript:select('left')">
						<img class="left" src="../public/lobster/images/redpack.png" />
					</a>
					<a href="javascript:select('right')">
						<img class="right" src="../public/lobster/images/redpack.png" />
					</a>
				</div>
				<!--开奖结果-->
				<div id="on-kaijiang" class="on-kaijiang" >
				
					<div style="display:none">
						<div class="padd">
							<p class="com_box">
								<img src="http://dqimgs.shdqdzsw.com/F973SbtIIzzEzXWwmYaYsPUQ.png">
							</p>
							<div class="padd_com_inner">
								<p class="msg">
									竹炭牙刷1支
								</p>
								<input type="hidden" name="goodId"  value="50000120">
								<p>
									<span class="com_jiage">商品价格</span>
									<span class="jiage">19.0</span>
								</p>
							</div>
						</div>
					</div>
					
					<div style="display:none">
						<div class="padd">
							<p class="com_box">
								<img src="http://dqimgs.shdqdzsw.com/yLe6RbLstEm6mje1H-f2gD0t.png">
							</p>
							<div class="padd_com_inner">
								<p class="msg">
									软毛长柄搓澡刷
								</p>
								<input type="hidden" name="goodId"  value="50000121">
								<p>
									<span class="com_jiage">商品价格</span>
									<span class="jiage">30.78</span>
								</p>
							</div>
						</div>
					</div>
					
					<!-- <div>
						<div class="padd">
							<p class="com_box">
								<img src="img/cp1.png">
							</p>
							<div class="padd_com_inner">
								<p class="msg">
									xxxxxxxxxx
								</p>
								<p>
									<span class="com_jiage">商品价格</span>
									<span class="jiage">4165</span>
								</p>
							</div>
						</div>
					</div> -->
				</div>
			</div>
			<!-- <div class="box">
				<div class="t_news">
					
					<ul class="news_li">
						<li><a href="#" >1水果忍者：穿靴子的猫</a></li>
						<li><a href="#" >乐动魔方 Plus</a></li>
						<li><a href="#" >亡灵杀手 汉化版</a></li>
						<li><a href="#" >jq22 搜集整理</a></li>
						<li><a href="#" >你疯啦 iphone壁纸</a></li>
					</ul>
					<ul class="swap"></ul>
				</div>
			</div> -->

				<a class="success">
				<div class="inner" id="pmd">
					
						<p>恭喜用户 A1212660207 获得 欧莱雅男士护肤套装  水能双效保湿三件套 </p>
					
						<p>恭喜用户 A1217043370 获得 无油烟厨房烹饪锅具三件套燃气灶电磁炉通用 </p>
					
						<p>恭喜用户 A1217043370 获得 苏泊尔 （SUPOR）电饭煲电饭锅5L大容量 </p>
					
						<p>恭喜用户 A1210362126 获得 无油烟厨房烹饪锅具三件套燃气灶电磁炉通用 </p>
					
						<p>恭喜用户 00000411387 获得 软毛长柄搓澡刷 </p>
					
						<p>恭喜用户 A1214633219 获得 软毛长柄搓澡刷 </p>
					
						<p>恭喜用户 A1227236580 获得 软毛长柄搓澡刷 </p>
					
						<p>恭喜用户 A1110037060 获得 软毛长柄搓澡刷 </p>
					
						<p>恭喜用户 00008035478 获得 娇颜弹润保湿乳（100mlx1瓶） </p>
					
						<p>恭喜用户 00006667000_bak 获得 5 L、2.5L两壶装纯茶油 </p>
					
				
				</div>
			</a>


			
		</div>
		
		<!--结果-->
		<div class="done" id="done">
			<div class="inner">
				<div class="off">
					<img id="off" src="../public/lobster/images/off.png">
				</div>
				<div class="padd">
					<p class="com_box">
						<img src="../public/lobster/images/cp1.png">
					</p>
					<div class="padd_com_inner">
						<p class="msg">
							xxxxxxxxxx
						</p>
						<p>
							<span class="com_jiage">商品价格</span>
							<span class="jiage">4165</span>
						</p>
					</div>
				</div>
			</div>
		</div>
		
		
		<nav class="nav">
			<ul id="list">
				<li>
					<a href="index.html">
						<img src="../public/lobster/images/navbar01.png" alt="">
					</a>
				</li>
				<li>
					<a href="lotteryInfo.html">
						<img src="../public/lobster/images/navbar02.png" alt="">
					</a>
				</li>
				<li>
					<a href="center.html">
						<img src="../public/lobster/images/onnavbar03.png" alt="">
					</a>
				</li>
			</ul>
		</nav>
	</body>
	
     
	<script src="../public/lobster/js/xxy.js"></script>
	 <script src="../public/lobster/js/jq-2.1.0.js"></script>
	
 <script>
	
	var pad = document.getElementById('pmd'),
		pad_li = pad.children.length,
		pad_n = 0,
		pad_h = 0;
	window.setInterval(function(){
		pad_n++;
		pad_h+=0.68;
		if(pad_n==pad_li){
			pad_h=pad_n=0;
		}
		pad.style.top = '-'+pad_h+'rem';
	},3000);

		var global={
			select:false,
			doneDom:document.getElementById('done'),
			on_kaijiang:document.getElementById('on-kaijiang'),
			off_kaijiang:document.getElementById('off-kaijiang')
		}
		global.on_kaijiang.style.display='none';
		/*左右选择*/
		function select(e){
			console.log(e)
			global.select=e=='left'?'left':'right';
			console.log(global.select)
			
			xxy.popup('是否确定选择此红包',function(e){
				if(e==0){
					var depotId = "81251a2fdb7b4b94bcb929a3e7b8da12";
					var goodsId ="50000120";
					var boxsite = global.select=='left'?0:1,
							onbox = global.on_kaijiang.children[boxsite],
							box = global.doneDom,
							src = onbox.querySelector('.com_box img').src,
							msg = onbox.getElementsByClassName('msg')[0].innerText,
							jiage = onbox.getElementsByClassName('jiage')[0].innerText
					 var selectGoodsId = onbox.getElementsByTagName('input')[0].value;
					//------先获取输赢产品的信息
					var goods = [{"brand":"山茶油","chargeMoney":2,"costPrice":1.9,"fee":2.66,"freight":10,"id":"50000120","imgurl":"http://dqimgs.shdqdzsw.com/F973SbtIIzzEzXWwmYaYsPUQ.png","iszt":0,"name":"竹炭牙刷1支","num":0,"price":16.34,"size":0,"status":-1,"type":"3","url":"http://dqimgs.shdqdzsw.com/qHy1OYE_rj9vyVg3nnLwYIRV.jpg,http://dqimgs.shdqdzsw.com/zfIibP2IE79VwLA-_OJjcLqr.jpg,http://dqimgs.shdqdzsw.com/kB6GvK805tdjZeQ0XQor3hnQ.jpg,http://dqimgs.shdqdzsw.com/j7-6YZNWQ9eXwuFwxr7WlF3H.jpg,http://dqimgs.shdqdzsw.com/JD1O4rJYhJ3QZxkTIgPVmMIf.jpg,http://dqimgs.shdqdzsw.com/VRiAvv1ktzkged5GZL05AQUv.jpg,http://dqimgs.shdqdzsw.com/xjVyOkx_p8HXlrJN4gElp1AQ.jpg","weight":0},{"brand":"山茶油","chargeMoney":2,"costPrice":0,"fee":0,"freight":10,"id":"50000121","imgurl":"http://dqimgs.shdqdzsw.com/yLe6RbLstEm6mje1H-f2gD0t.png","iszt":0,"name":"软毛长柄搓澡刷","num":0,"price":30.78,"size":5,"status":1,"type":"1","url":"http://dqimgs.shdqdzsw.com/cfv247yc3RZiFSuWqE1Pwf1q.jpg,http://dqimgs.shdqdzsw.com/NMAUbN3gt1Jk2zrkIC1tRvNd.jpg,http://dqimgs.shdqdzsw.com/KiY76dnW8bCiFWhwMd4qXQoi.jpg,http://dqimgs.shdqdzsw.com/lxipNaRS-5Xd12gbb0WB66Bz.jpg","weight":0}]
		
					var win_goodsid = "";
					var win_src = "";
					var win_msg = "";
					var win_jiage = "";
					var win_html = "";
					
					var lose_goodsid = "";
					var lose_src = "";
					var lose_msg = "";
					var lose_jiage = "";
					var lose_html = "";
					
					for(var idx in goods)
					{
						var obj = goods[idx];
						if(obj.id == goodsId)
						{
							lose_goodsid = goodsId;
							lose_src = obj.imgurl;
							lose_msg = obj.name;
							lose_jiage = obj.price + obj.fee;
							lose_html = '<div><div class="padd"><p class="com_box"><img src="/public/lobster/images/'+obj.imgurl+'"></p><div class="padd_com_inner"><p class="msg">'+obj.name +'</p><input type="hidden" name="goodId"  value="'+obj.id+'"><p><span class="com_jiage">商品价格</span><span class="jiage">'+(obj.price+obj.fee)+'</span></p></div></div></div>';
						}else
						{
							win_goodsid = obj.id;
							win_src = obj.imgurl;
							win_msg = obj.name;
							win_jiage = obj.price + obj.fee;
							win_html = '<div><div class="padd"><p class="com_box"><img src="/public/lobster/images/'+obj.imgurl+'"></p><div class="padd_com_inner"><p class="msg">'+obj.name +'</p><input type="hidden" name="goodId"  value="'+obj.id+'"><p><span class="com_jiage">商品价格</span><span class="jiage">'+(obj.price+obj.fee)+'</span></p></div></div></div>';
						}
					}
					//-- chadwick
					
					$.ajax({
						type:"POST",
						url:"/redpack/addOrder?v="+Math.random(),
						data:{"depotId":depotId,goodsId:goodsId,gametype:7,selectGoodsId:selectGoodsId,selecttag:global.select},
						dataType:"json",
						success:function(data){
							// 铃声 
							var audio=document.createElement("audio");
					        audio.src='/public/lobster/video/dingding.mp3';
					        audio.play();
							if(data.success){
								if(data.data && data.data.win == 1)
								{
									box.querySelector('.com_box img').src = "/public/lobster/images/"+win_src;
									box.getElementsByClassName('msg')[0].innerText = win_msg;
									box.getElementsByClassName('jiage')[0].innerText = win_jiage;
									if(global.select == 'left')
									{
										$('#on-kaijiang').html(win_html+lose_html);
									}else
									{
										$('#on-kaijiang').html(lose_html+win_html);
									}
								}
								else
								{
									box.querySelector('.com_box img').src = "/public/lobster/images/"+lose_src;
									box.getElementsByClassName('msg')[0].innerText = lose_msg;
									box.getElementsByClassName('jiage')[0].innerText = lose_msg;
									if(global.select == 'left')
									{
										$('#on-kaijiang').html(lose_html+win_html);
									}else
									{
										$('#on-kaijiang').html(win_html+lose_html);
									}
								}
								global.doneDom.style.display = 'block';
								//set信息
							}else{
								xxy.alert(data.msg);
								
							}
						}
					});
					
					
				}else{
					xxy.toast('已取消');
				}
			});
		}
		global.doneDom.addEventListener('click',function(e){
			var target=e.target;
			if(target.id=='off'){
				this.style.display='none';
				done_result();
			}
			
		});
		function done_result(){
			function a(aa){
				global.on_kaijiang.children[aa].style.filter='brightness(0.7)';
				global.on_kaijiang.children[aa].style.webkitFilter='brightness(0.7)';
			}
			global.off_kaijiang.style.display='none';
			global.on_kaijiang.style.display='block';
			console.log(global.select)
			if(global.select=='left'){
				a(1);
			}else{
				a(0);
			}
		}
		
		/*filter: brightness(0.7);*/
		/*下单*/
		/*function success(){
			if(!global.select){
				xxy.toast('您还未选择');
				return false;
			}
			xxy.popup('是否下单',function(e){
				if(e==0){
					console.log('下单');
				}else{
					xxy.toast('已取消');
				}
			});
		}*/
	</script>
</html>